package com.itheima.练习.test2;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.Socket;
//客户端
public class Client {
    public static void main(String[] args) throws IOException {
        Socket socket=new Socket("127.0.0.1",10000);
        OutputStream os = socket.getOutputStream();
        os.write("你好".getBytes());

        socket.shutdownOutput();


        //接收
        InputStream is = socket.getInputStream();
        InputStreamReader isr=new InputStreamReader(is);
        int b=0;
        while ((b=isr.read())!=-1){
            System.out.print((char)b);
        }


        socket.close();
    }
}


//两个细节
//数据流向
//如何让他停止输入